- @suppress_diff ||= @suppress_diff || @force_suppress_diff
- if @suppress_diff
  .alert.alert-block
    %p
      %strong 警告! 这个差异很大...
    %p
      为了不让您的浏览器死掉, 所以不敢显示.
      - if current_controller?(:commit) or current_controller?(:merge_requests)
        所以, 请下载差异文件
        - if current_controller?(:commit)
          = link_to "plain diff", project_commit_path(@project, @commit, format: :diff), class: "underlined_link"
          or
          = link_to "email patch", project_commit_path(@project, @commit, format: :patch), class: "underlined_link"
        - else
          = link_to "plain diff", project_merge_request_path(@project, @merge_request, format: :diff), class: "underlined_link"
          or
          = link_to "email patch", project_merge_request_path(@project, @merge_request, format: :patch), class: "underlined_link"
        instead.
    - unless @force_suppress_diff
      %p
        如果你非要显示差异, 那么
        = link_to "请点击这里", url_for(force_show_diff: true), class: "underlined_link"

%p.commit-stat-summary
  Showing
  %strong.cdark #{pluralize(diffs.count, "changed file")}
  - if current_controller?(:commit)
    - unless @commit.has_zero_stats?
      with
      %strong.cgreen #{@commit.stats.additions} additions
      and
      %strong.cred #{@commit.stats.deletions} deletions
.file-stats
  = render "projects/commits/diff_head", diffs: diffs

.files
  - unless @suppress_diff
    - diffs.each_with_index do |diff, i|
      - next if diff.diff.empty?
      - file = Gitlab::Git::Blob.new(project.repository, @commit.id, @ref, diff.new_path)
      - file = Gitlab::Git::Blob.new(project.repository, @commit.parent_id, @ref, diff.old_path) unless file.exists?
      - next unless file.exists?
      .file{id: "diff-#{i}"}
        .header
          - if diff.deleted_file
            %span= diff.old_path

            - if @commit.parent_ids.present?
              = link_to project_blob_path(project, tree_join(@commit.parent_id, diff.new_path)), {:class => 'btn btn-tiny pull-right view-file'} do
                View file @
                %span.commit-short-id= @commit.short_id(6)
          - else
            %span= diff.new_path
            - if diff.a_mode && diff.b_mode && diff.a_mode != diff.b_mode
              %span.file-mode= "#{diff.a_mode} → #{diff.b_mode}"

            = link_to project_blob_path(project, tree_join(@commit.id, diff.new_path)), {:class => 'btn btn-tiny pull-right view-file'} do
              浏览文件 @
              %span.commit-short-id= @commit.short_id(6)

        .content
          -# Skipp all non non-supported blobs
          - next unless file.respond_to?('text?')
          - if file.text?
            = render "projects/commits/text_file", diff: diff, index: i
          - elsif file.image?
            - old_file = Gitlab::Git::Blob.new(project.repository, @commit.parent_id, @ref, diff.old_path) if @commit.parent_id
            = render "projects/commits/image", diff: diff, old_file: old_file, file: file, index: i
          - else
            %p.nothing_here_message 没办法预览, 因为我知道这是什么文件类型.
